package dao;

import java.util.ArrayList;

import model.Lid;
import model.Veld;
import dao.interfaces.VeldDao;

public class VeldDaoMock implements VeldDao{

	private static VeldDaoMock instance;
	private ArrayList<Veld> velden;
	
	private VeldDaoMock(){
		velden = new ArrayList<Veld>();
		velden.add(new Veld(1));
		velden.add(new Veld(2));
		velden.add(new Veld(3));
	}
	
	public static VeldDaoMock getInstance(){
		if(instance == null){
			instance = new VeldDaoMock();
		}
		return instance;
	}

	@Override
	public void reserveerVeld(int veldNr, Lid lid) {
		for(Veld v : velden){
			if(v.getVeldNr() == veldNr){
				v.reserveer(lid);
			}
		}
	}

	@Override
	public void addVeld() {
		System.out.println("addVeld aanroep");
	}

	@Override
	public ArrayList<Veld> getOverzichtVanVelden() {
		return velden;
	}
	
	@Override
	public Veld getVeld(int veldNr){
		for(Veld v : velden){
			if(v.getVeldNr() == veldNr){
				return v;
			}
		}
		return null;
	}
	
	@Override
	public void setVeldVrij(int veldNr){
		Veld veld = getVeld(veldNr);
		veld.maakVrij();
	}
}
